package edu.gdkm.dao;

import edu.gdkm.pojo.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface IBookDao {
    @Insert("insert into book value(null,#{bname},0,#{price},#{bdesc})")
    @Options(useGeneratedKeys=true, keyProperty="bid", keyColumn="bid")
    public Integer insertBook(Book book);
    @Update("update book set bname=#{bname},btype=#{btype},price=#{price},bdesc=#{bdesc} where bid=#{bid}")
    public Integer updateBook(Book book);
    @Delete("delete from book where bid=#{bid}")
    public Integer delBookByBid(Integer bid);
    @Select("select * from book where bid=#{bid}")
    public Book getBookByBid(Integer bid);
    @Select("select * from book")
    public List<Book> getBookList();
    @Select("select count(*) from book")
    public long getBookCount();
}
